<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>商户优惠信息录入界面</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<%@include file="/includes/jsp/base.jsp" %>
	<script type="text/javascript">
		function setImgSrc(){
			document.getElementById('imgSrc').value = document.getElementById('imgFile').value;
		}
		function setShopImgSrc(){
			document.getElementById('shopImgSrc').value = document.getElementById('shopImgFile').value;
		}
		function load(){
			var type = document.getElementById("discounts.type");
			var typeVal = '<s:property value="discounts.type"/>';
			for(var i = 0; i < type.length; i++){
				if(type.options[i].value == typeVal){
					type.options[i].selected = true;
				}
			}
		}
	</script>
  </head>
  
  <body onload="load()">
    <s:form name="form1" id="from1" enctype="multipart/form-data" action="discounts/discounts_addDiscounts">
    	<s:hidden name="discounts.id" />
    	<div style="height:40;width:100%;text-align:center;">商户优惠信息录入界面</div>
    	<table style="border:0;" align="center">
    		<tr><td>商户名称：</td><td><input type="text" value="${discounts.shopName}" name="discounts.shopName" id="shopName" /></td></tr>
    		<tr><td>商户描述：</td><td><input type="text" value="${discounts.shopDesc}" name="discounts.shopDesc" id="shopDesc" /></td></tr>
    		<tr><td>商户地址：</td><td><input type="text" value="${discounts.address}" name="discounts.address" id="address"/></td></tr>
    		<tr><td>联系方式：</td><td><input type="text" value="${discounts.contact}" name="discounts.contact" id="contact"/></td></tr>
    		<tr><td>优惠商品：</td><td><input type="text" value="${discounts.goods}" name="discounts.goods" id="goods"/></td></tr>
    		<tr><td>商品类别：</td><td><select name="discounts.type" id="discounts.type">
			    					<option value="K1">美食（特色、小吃、酒店）</option>
			    					<option value="K2">家居（装修、建材）</option>
			    					<option value="K3">数码（手机、电脑、相机）</option>
			    					<option value="K4">服装（服装、帽、鞋、包、帽）</option>
			    					<option value="K5">休闲 (KTV、酒吧、洗浴)</option>
			    					<option value="K6">美容（健身、SAP)</option>
			    					<option value="K7">房产（品牌地产、二手房）</option>
			    					<option value="K8">户外（旅行社、野郊、暴走）</option>
			    				</select>
    		<tr><td>商品描述：</td><td><input type="text" value="${discounts.disp}" name="discounts.disp" id="disp"/></td></tr>
    		<tr><td>优惠开始时间：</td><td><input type="text" value="${discounts.begintime}" name="discounts.begintime" id="begintime"/></td></tr>
    		<tr><td>优惠截止时间：</td><td><input type="text" value="${discounts.endtime}" name="discounts.endtime" id="endtime"/></td></tr>
    		<tr><td>原价：</td><td><input type="text" value="${discounts.original}" name="discounts.original" id="original"/></td></tr>
    		<tr><td>现价：</td><td><input type="text" value="${discounts.current}" name="discounts.current" id="current"/></td></tr>
    		<tr><td>折扣：</td><td><input type="text" value="${discounts.discount}" name="discounts.discount" id="discount"/></td></tr>
    		<tr><td>被赞数量：</td><td><input type="text" value="${discounts.approval}" name="discounts.approval" id="approval"/></td></tr>
    		<tr><td>序号（置顶）：</td><td><input type="text" value="${discounts.inno}" name="discounts.inno" id="inno"/></td></tr>
    		<tr><td>状态：</td><td><input type="text" value="${discounts.status}" name="discounts.status" id="status"/></td></tr>
    		<tr><td>商户LOGO名称：</td><td><input type="text" value="${discounts.shopImg}" name="discounts.shopImg" id="shopImg" /></td></tr>
    		<tr height="40"><td>商户LOGO</td><td><img src="${discounts.shopImgSrc}" alt="${discounts.shopImg}"/></td></tr>
    		<tr><td>商户LOGO上传：</td><td><input type="file" name="shopImgFile" id="shopImgFile" onchange="setShopImgSrc()"/><input type="text" style="display:none;" name="discounts.shopImgSrc" id="shopImgSrc"/></td></tr>
    		<tr><td>优惠商品图片名称：</td><td><input type="text" value="${discounts.imgname}" name="discounts.imgname" id="imgName"/></td></tr>
    		<tr><td>优惠商品图片上传：</td><td><input type="file" name="imgFile" id="imgFile" onchange="setImgSrc()"/><input type="text" style="display:none;" name="discounts.imgsrc" id="imgSrc"/></td></tr>
    		<tr><td>优惠商品图片</td><td><img src="${discounts.imgsrc}" alt="${discounts.imgname}"/></td></tr>
    		<tr><td colspan="2" align="center"><input type="submit" value="提交"/><input type="reset" value="重置" /></td></tr>
    	</table>
  	</s:form>
  </body>
</html>
